import java.util.Scanner;

public class Test1 {
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = 3;
        while (count > 0){
            System.out.print("请输入你的密码：");
            String sc = scanner.nextLine();
            if(sc.equals("123456")){
                System.out.println("登陆成功！");
                break;
            }else{
                count--;
                System.out.println("你还有 " + count + " 次机会！");
            }
            Scanner close;
        }
    }
    public static void main1(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        while(num > 0){
            int n = num;
            n = num % 10;
            System.out.println(n);
            num /= 10;
        }
        Scanner close;
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        for(int i = 1; i <= n; i++){
            int mul = 1;
            for(int j = 1; j <= i; j++){
                mul *= j;
            }
            sum += mul;
        }
        System.out.println(sum);
        Scanner close;
    }

    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = 1, b = 1, c = 0, count = 1;
        while(count <= n){
            if(count == 1 || count == 2){
                System.out.println(1);
            }else{
                c = a + b;
                System.out.println(c);
                a = b;
                b = c;
            }
            count++;
        }
    }
//
//    public static int max(int a, int b) {
//        return a > b? a : b;
//    }
//
//    public static double max(double a, double b, double c) {
//        return (a > b? a : b) > c? (a > b? a : b) : c;
//    }
//
//    public static void main(String[] args) {
//        int big = max(1, 4);
//        System.out.println(big);
//        double more = max(2.1, 3.1, 4.1);
//        System.out.println(more);
//    }
//public static int Mul(int n) {
//        if(n == 1){
//        return 1;
//    }else{
//        return n * Mul(n - 1);
//        }
//}
//public static int Add(int n) {
//    if(n == 1){
//        return 1;
//    }else{
//        return n = n + Add(n - 1);
//    }
//}
//public static void print(int n) {
//    if(n == 0){
//        return;
//    }else{
//        int i = n;
//        print(i / 10);
//        i = n % 10;
//        System.out.print(i + " ");
//    }
//}
//public static int Print(int n) {
//    int i = 0;
//    if(n == 0){
//        return 0;
//    }else{
//        i = n % 10;
//        return i = i + Print(n / 10);
//    }
//}
//public static void Fib(int n, int a, int b) {
//    if(n == 2){
//        return;
//    }else{
//        int c = 0;
//        c = a + b;
//        System.out.println(c);
//        n--;
//        Fib(n, b, c);
//    }
//}
//public static void main(String[] args) {
//    Scanner scanner = new Scanner(System.in);
//    int n = scanner.nextInt();
//    if(n > 3){
//        System.out.println(1);
//        System.out.println(1);
//    }
//    Fib(n, 1,1);
//}
public static void Hanio(int n, char pos1, char pos2, char pos3) {
    if(n == 1){
        Move(pos1, pos3);
        return;
    }
    Hanio(n-1, pos1, pos3, pos2);
    Move(pos1, pos3);
    Hanio(n-1, pos2, pos1, pos3);
}

    public static void Move(char posS, char posD) {
        System.out.print(posS + "->" + posD + " ");
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Hanio(n, 'a', 'b', 'c');
    }
}
